package com.part2.business.function.Impl;

import java.util.List;

import com.part2.action.common.validator.Validator;
import com.part2.beans.Bigclass;
import com.part2.beans.Smallclass;
import com.part2.common.query.Page;
import com.part2.dao.common.BaseDao;
import com.part2.dao.function.BigClassDao;

public class BigClassServiceImpl implements com.part2.business.function.BigClassService {

	private BaseDao<Bigclass, String> baseDao;
	private BigClassDao bigClassDao;

	public void setBaseDao(BaseDao<Bigclass, String> baseDao) {
		this.baseDao = baseDao;
	}

	public void setBigClassDao(BigClassDao bigClassDao) {
		this.bigClassDao = bigClassDao;
	}

	public void addBigClass(Bigclass bigClass) {
		// TODO Auto-generated method stub
		baseDao.save(bigClass);
	}

	public void deleteBigClass(String id) {
		// TODO Auto-generated method stub
		if(Validator.isNotNull(id)){
			Bigclass bg = this.findBigClassByPrimeKey(id);
			if(bg!=null)
				baseDao.delete(bg);
		}
	}

	public List<Bigclass> findBigClass() {
		// TODO Auto-generated method stub
		return baseDao.findAll(Bigclass.class);
	}

	public Page<Bigclass> findBigClass(Page<Bigclass> page) {
		// TODO Auto-generated method stub
		return bigClassDao.findBigClass(page);
	}

	public Bigclass findBigClassByPrimeKey(String id) {
		// TODO Auto-generated method stub
		return bigClassDao.findBigClassByPrimeKey(id);
	}

	public void updateBigClass(Bigclass bigClass) {
		// TODO Auto-generated method stub
		baseDao.saveOrUpdate(bigClass);
	}

	public List<Smallclass> findSmallClassByBigClass(String bId) {
		// TODO Auto-generated method stub
		return bigClassDao.findSmallClassByBigClass(bId);
	}

}
